package com.vcms.cms.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.vcms.cms.dao.UserInfoDao;
import com.vcms.cms.entity.UserInfo;


@Repository
public class UserInfoDaoImpl extends HibernateDaoSupportImpl<UserInfo>
		implements UserInfoDao {

	@Override
	public UserInfo findByAccountAndPsw(UserInfo userInfo) {
		String queryString = "from UserInfo u where "
				+ "u.account=:account and u.psw=:psw and u.isActivated=1";
		Query query = getSession().createQuery(queryString);
		query.setString("account", userInfo.getAccount()).setString("psw",
				userInfo.getPsw());
		return (UserInfo) query.uniqueResult();
	}

}
